package com.itheima.article.feign;

import com.itheima.article.pojo.ApAuthor;
import com.itheima.common.vo.ResultVo;
import com.itheima.core.feign.CoreFeign;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @version 1.0
 * @description 说明
 * @package com.itheima.article.feign
 */
@FeignClient(name = "leadnews-article", contextId = "apAuthorFeign")
public interface ApAuthorFeign extends CoreFeign<ApAuthor> {

    /**
     * 通过用户id与自媒体账号id获取作者信息
     * @param apUserId 用户id
     * @param wmUserId 自媒体账号id
     * @return
     */
    @GetMapping("/api/apAuthor/{apUserId}/{wmUserId}")
    ResultVo<ApAuthor> getByApUserIdWmUserId(
        @PathVariable(name = "apUserId") Integer apUserId,
        @PathVariable(name = "wmUserId") Integer wmUserId);

    /**
     * 创建作者账号
     * @param author
     * @return
     */
    @PostMapping("/api/apAuthor/add")
    ResultVo add(@RequestBody ApAuthor author);
}
